package org.minproject.my_library_back.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.minproject.my_library_back.common.CommonResponse;
import org.minproject.my_library_back.domain.User;
import org.minproject.my_library_back.service.UserService;
import org.minproject.my_library_back.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author Lenovo
* @description 针对表【user】的数据库操作Service实现
* @createDate 2024-11-21 09:11:46
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{
    @Autowired
    UserMapper userMapper;
    @Override
    public CommonResponse<User> getUserByUserid(String userid) throws Exception {
        User user = userMapper.selectById(userid);
        if(user==null)
        {
            return CommonResponse.createForSuccess("没有该userid的用户",null);
        }
        return CommonResponse.createForSuccess("查询成功",user);
    }
}




